package com.example.administrator.shzs.adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.example.administrator.shzs.R;
import com.example.administrator.shzs.entity.OrderList.FoodlistBean;
import java.util.List;

/**
 * 订单详情页  每个商品订单  适配器
 * Created by Administrator on 2016/11/7.
 */

public class OrderDetailAdapter extends RecyclerView.Adapter<OrderDetailAdapter.VideoHolderOreder> {

    private Context context;
    private List<FoodlistBean> datalist;


    public OrderDetailAdapter(Context context, List<FoodlistBean> datalist) {
        this.context = context;
        this.datalist = datalist;
    }


    @Override
    public VideoHolderOreder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(context).inflate(R.layout.orderdetail_recyclerview_item, null);
        VideoHolderOreder videoHolderOreder = new VideoHolderOreder(view);
        return videoHolderOreder;
    }

    @Override
    public void onBindViewHolder(VideoHolderOreder holder, int position) {

        holder.Order_Item_Moneny.setText("￥" + datalist.get(position).getFoodPrice());
        holder.Order_Item_number.setText("x" +datalist.get(position).getNum());
        holder.Order_Item_name.setText(datalist.get(position).getFoodname());

    }

    @Override
    public int getItemCount() {
        return datalist == null ? 0 : datalist.size();
    }

    class VideoHolderOreder extends RecyclerView.ViewHolder {
        private TextView Order_Item_name;
        private TextView Order_Item_number;
        private TextView Order_Item_Moneny;

        public VideoHolderOreder(View itemView) {
            super(itemView);
            Order_Item_name = (TextView) itemView.findViewById(R.id.Order_Item_name);
            Order_Item_number = (TextView) itemView.findViewById(R.id.Order_Item_number);
            Order_Item_Moneny = (TextView) itemView.findViewById(R.id.Order_Item_Moneny);
        }
    }

}
